package com.acme.bankapp.domain.bank;

public class SavingsAccount implements Account{
	protected double balance;
	public SavingsAccount(double amount){
		if (amount<0){
			System.out.println("Error creating account! (amount has negative value)");
		} else {
			this.balance = amount;
		}
	}
	public void deposit(double amount){
		this.balance+=amount;
	}

	public boolean withdraw(double amount){
		if (this.balance>=amount){
			this.balance-=amount;
			return true;
		} else {
			System.out.println("Error in method withdraw, class Account! (amount has negative value)");
			return false;
		}
	}

	// TODO: add another methods like getBalance();

	public double getBalance() {
		return balance;
	}
	public void setBalance(double balance) {
		this.balance = balance;
	}
	@Override
	public double maximumAmountToWithdraw() {
		return this.balance;
	}

}
